//解决IE8 Object.keys()问题
var DONT_ENUM = "propertyIsEnumerable,isPrototypeOf,hasOwnProperty,toLocaleString,toString,valueOf,constructor"
		.split(","), hasOwn = ({}).hasOwnProperty;
for (var i in {
	toString : 1
}) {
	DONT_ENUM = false;
}

Object.keys = Object.keys || function(obj) {// ecma262v5 15.2.3.14
			var result = [];
			for (var key in obj)
				if (hasOwn.call(obj, key)) {
					result.push(key);
				}
			if (DONT_ENUM && obj) {
				for (var i = 0; key = DONT_ENUM[i++];) {
					if (hasOwn.call(obj, key)) {
						result.push(key);
					}
				}
			}
			return result;
		};

function extend(dst) {
	var h = dst.$$hashKey;

	for (var i = 1, ii = arguments.length; i < ii; i++) {
		var obj = arguments[i];
		if (obj) {
			var keys = Object.keys(obj);
			for (var j = 0, jj = keys.length; j < jj; j++) {
				var key = keys[j];
				dst[key] = obj[key];
			}
		}
	}

	setHashKey(dst, h);
	return dst;
}

function logo_bbs(obj) {
	try {
		obj.onerror = null;
		obj.src = 'images/forum.gif';
	} catch (ex) {
	}
}

function logo_user(obj) {
	try {
		obj.onerror = null;
		obj.src = 'bbs/images/bklogo.jpg';
	} catch (ex) {
	}
}
function killErrors() {
	return true;
}
window.onerror = killErrors;

function substr(str, len) {
	if (!str || !len) {
		return '';
	}
	var a = 0;
	var temp = '';
	for (var i = 0; i < str.length; i++) {
		a += str.charCodeAt(i) > 255 ? 2 : 1;
		if (a > len)
			return temp;
		temp += str.charAt(i);
	}
	return str;
};

function getExt(file) {
	return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
function strReverse(s) {
	return s.replace(/(<BR>|<BR\/>)/ig, "\n");
}

function strRemoveBr(s) {
	return s.replace(/(<BR>|<BR\/>)/ig, "");
}
function strConvert(s) {
	s = s.replace(/(<)/ig, "&lt;");
	s = s.replace(/(\n)/g, "<BR>");
	return s;
}

